package cn.hy.preparelesson.common.enums;

public enum SchoolSemesterEnum {
    ONE((byte)1, "第一学期"),
    TWO((byte)2, "第二学期")
    ;
    private byte code;
    private String msg;

    SchoolSemesterEnum() {
    }

    SchoolSemesterEnum(byte code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public byte getCode() {
        return code;
    }

    public void setCode(byte code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 根据code 获取
     * @param code
     * @return
     */
    public static SchoolSemesterEnum getByCode(Byte code) {
        if (code == null) {
            return null;
        }
        for (SchoolSemesterEnum value : SchoolSemesterEnum.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

}
